package com.hnkywl.sts.action.flow.endState;

import com.hnkywl.sts.util.ApplicationInstance;
import com.hnkywl.sts.entity.jhgl.Tpzjjh;
import com.hnkywl.sts.service.jhgl.ZjjhService;
import org.jbpm.api.listener.EventListener;
import org.jbpm.api.listener.EventListenerExecution;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created with IntelliJ IDEA.
 * User: jerry
 * Date: 13-5-8
 * Time: 下午2:22
 * To change this template use File | Settings | File Templates.
 */
public class EndTpzjjhState implements EventListener {
    private static ApplicationContext ac;

    static {
        ac = new ClassPathXmlApplicationContext("spring-config.xml");
    }

    @Override
    public void notify(EventListenerExecution execution) throws Exception {
        // 改变状态  ytj--->ysp
        ZjjhService zjjhService = ApplicationInstance.createZjjhService();
        Tpzjjh tpzjjh = zjjhService.findTpzjjhDetailByProcessInstance(execution.getProcessInstance().getId());
        tpzjjh.setZt("ysp");
        zjjhService.saveTpzjjh(tpzjjh);
    }
}
